import getState from "@/api/state";
import ZuiEchart from "@/template/zuiEchart/zuiEchart";

import React from "react";
import { useEffect } from "react";
import { useState } from "react";

const Base3 = ({ condition }) => {
    const [loading, setLoading] = useState(false)
    const [message, setMessage] = useState("暂无数据");
    const [state, setState] = useState([
        {
            name: '全险种',
            data: [

            ]
        },
        {
            name: '全险种',
            data: [

            ]
        },
        {
            name: '全险种',
            data: [
            ]
        },
        {
            name: '全险种',
            data: [

            ]
        }
    ]);

    useEffect(() => {
        getState({
            apiUrl: "/cifgp-core-api/baseQuery/pieChart",
            state,
            condition: { ...condition, cType: "baseGender" },
            setState,
            setLoading,
            nameList: ["男性", "女性", "未知"],
            setMessage
        })
    }, [condition])

    return (
        <>
            <ZuiEchart
                keyWord={["sex"]}
                message={message}
                loading={loading}
                style={{ width: "25%", height: "420px" }}
                data={state}
                defaultModule="pie"
                pieType={"2"}

                btn={state.map(item => item.name)}
                title="性别分布"
                unit="个"
            />
        </>
    )
}
export default Base3;